var sPop = null;
var postSubmited = false;

var userAgent = navigator.userAgent.toLowerCase();
var is_opera = (userAgent.indexOf('opera') != -1);
var is_saf = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var is_webtv = (userAgent.indexOf('webtv') != -1);
var is_ie = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4 = ((is_ie) && (userAgent.indexOf('msie 4.') != -1));
var is_moz = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon = (userAgent.indexOf('konqueror') != -1);
var is_ns = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4 = ((is_ns) && (parseInt(navigator.appVersion) == 4));
var is_mac = (userAgent.indexOf('mac') != -1);

var _subdir = $("meta[name='subdir']").attr('content');
if (_subdir == 'undefined' || !_subdir)
{
	_subdir = '';
}

function arraypop(a) {
	if(typeof a != 'object' || !a.length) {
		return null;
	} else {
		var response = a[a.length - 1];
		a.length--;
		return response;
	}
}

function arraypush(a, value) {
	a[a.length] = value;
	return a.length;
}


function findtags(parentobj, tag) {
	if(typeof parentobj.getElementsByTagName != 'undefined') {return parentobj.getElementsByTagName(tag);}
	else if(parentobj.all && parentobj.all.tags) {return parentobj.all.tags(tag);}
	else {return null;}
}

function in_array(needle, haystack) {
	if(typeof needle == 'string') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	}
	return false;
}

/*
名称：Cookie函数
版本：1.0.1 (Beta)
*/
var netos = netos || {};
netos.Cookie = {
/*
函数名称：HL.Cookie.Get([string name])
函数功能：得到Cookie
参数：name 可选项，要取得的Cookie名称
说明：name为空时将通过数组形式返回全部Cookie，name不为空时返回此Cookie名称的值，没有任何值时返回undefined
*/
	Get : function(name){
		var cv = document.cookie.split("; ");//使用"; "分割Cookie
		var cva = [], temp;
		/*循环的得到Cookie名称与值*/
		for(i=0; i<cv.length; i++){
			temp = cv[i].split("=");//用"="分割Cookie的名称与值
			cva[temp[0]] = unescape(temp[1]);
		}
		if(name) return cva[name];//如果有name则输出这个name的Cookie值
		//else return cva;//如果没有name则输出以名称为key，值为Value的数组
		else return '';
	},
/*
函数名称：HL.Cookie.Set(string name, string  value[, int expires[, string path[, string domain[, string secure]]]])
函数功能：存入Cookie
参数：name 必要项，要存入的Cookie名称
      value 必要项，要存入的Cookie名称对应的值
      expires 可选项，Cookie的过期时间，可以填入以秒为单位的保存时间，也可以填入日期格式（wdy, DD-Mon-YYYY HH:MM:SS GMT）的到期时间
      path 可选项，Cookie在服务器端的有效路径
      domain 可选项，该Cookie的有效域名
      secure 可选项， 指明Cookie 是否仅通过安全的 HTTPS 连接传送，0或false或空时为假
说明：保存成功则返回true，保存失败返回false
*/
	Set : function(name, value, expires, path, domain, secure){
		if(!name || !value) return false;//如果没有name和value则返回false
		if(name == "" || value == "") return false;//如果name和value为空则返回false
		/*对于过期时间的处理*/
		if(expires){
			/*如果是数字则换算成GMT时间，当前时间加上以秒为单位的expires*/
			if(/^[0-9]+$/.test(expires)){
				var today = new Date();
				expires = new Date(today.getTime()+expires*1000).toGMTString();
			/*判断expires格式是否正确，不正确则赋值为undefined*/
			}else if(!/^wed, \d{2} \w{3} \d{4} \d{2}\:\d{2}\:\d{2} GMT$/.test(expires)){
				expires = undefined;
			}
		}
		/*合并cookie的相关值*/
		var cv = name+"="+escape(value)+";"
		       + ((expires) ? " expires="+expires+";" : "")
		       + ((path) ? "path="+path+";" : "")
		       + ((domain) ? "domain="+domain+";" : "")
		       + ((secure && secure != 0) ? "secure" : "");
		/*判断Cookie总长度是否大于4K*/
		if(cv.length < 4096){
			document.cookie = cv;//写入cookie
			return true;
		}else{
			return false;
		}
	},
/*
函数名称：HL.Cookie.Del(string name[, string path[, string domain]])
函数功能：删除Cookie
参数：name 必要项，要删除的Cookie名称
      path 可选项，要删除的Cookie在服务器端的有效路径
      domain 可选项，要删除的Cookie的有效域名
说明：删除成功返回true，删除失败返回false
*/
	Del : function(name, path, domain){
		if(!name) return false;//如果没有name则返回false
		if(name == "") return false;//如果name为空则返回false
		if(!this.Get(name)) return false;//如果要删除的name值不存在则返回false
		/*合并Cookie的相关值*/
		document.cookie = name+"=;"
		                  + ((path) ? "path="+path+";" : "")
		                  + ((domain) ? "domain="+domain+";" : "")
		                  + "expires=Thu, 01-Jan-1970 00:00:01 GMT;";
		return true;
	}
}

function $id(pKey){
	return document.getElementById(pKey);
}

var iseditor=0;
var t_edialog;
var netos = netos || {};
netos.ajax = {
	loading : function(re,rs,wt){
		//请在此创建DIV

		//alert("X="+event.clientX+";Y="+event.clientY);
		$('#ajax_mess').css('top', $(document).scrollTop());

		re=parseInt(re);
		wt=parseInt(wt);
		switch (re){
			case 1:
			//ScreenClean();
			//$('#ajax_mess').html('&nbsp;&nbsp;操作完成！');
			setTimeout(function(){$('#ajax_mess').css('display','none');}, 300);
			break;

			case 2:
			//ScreenClean();
			$('#ajax_mess').html('&nbsp;&nbsp;操作失败－－');
			setTimeout(function(){$('#ajax_mess').css('display','none');}, 3000);
			break;

			case 3:
			setTimeout(function(){$('#ajax_mess').css('display','none');}, 100);
			break;

			case 4:
			$('#ajax_mess').css('display','block');
			$('#ajax_mess').css('top',document.body.scrollTop+'px');
			$('#ajax_mess').html('&nbsp;&nbsp;正在载入，请稍侯...');
			break;

			case 5:
			setTimeout(function(){$('#ajax_mess').css('display','none');}, 100);
			break;
			
			case 9:
			$('#ajax_mess').html('&nbsp;&nbsp;'+rs);
			setTimeout(function(){$('#ajax_mess').css('display','none');}, 3000);
			break;
		
			default:
			$('#ajax_mess').css('display','block');
			$('#ajax_mess').css('top',document.body.scrollTop+'px');
			$('#ajax_mess').html('&nbsp;&nbsp;正在处理，请稍侯...');
			break;
		}
	},

	load : function(p){
		this.loading(4);
		$.ajax({
			type: "post",
			url: "ajax_op.php",
			data: p,
			error: function(xml){
				netos.ajax.loading(2);
			},
			complete: function(xml){
				netos.ajax.loading(1);
			},
			success: function(xml){
				var id=$('id',xml).text();
				var val=$('val',xml).text();
				if (!id)
				{
					alert('ID捕获失败!请检查最后请求的函数,ajax.txt中记录ajax_op.php获取的值.')
				}else{
					$('#'+id).html(val);
				}
				netos.ajax.loading(5);
			}
		});
	},
	dload : function(p){
		$.ajax({
			type: "post",
			url: "ajax_op.php",
			data: p,
			error: function(xml){
				alert(xml);
			},
			complete: function(xml){
				//netos.ajax.loading(1);
			},
			success: function(xml){
				var id=$('id',xml).text();
				var val=$('val',xml).text();
				if (!id)
				{
					alert('ID捕获失败!请检查最后请求的函数,ajax.txt中记录ajax_op.php获取的值.')
				}else{
					$('#'+id).html(val);
				}

				var frame=$('frame',xml).text();
				$('#frame').val(frame);

			}
		});
	},
	form : function(p){
		
		$('#'+p.i).ajaxSubmit({
			type: "post",
			url: 'ajax_op.php',
			debug: true,
			beforeSubmit:function(xml){
				netos.ajax.loading(4);
				$('#work_box').dialog('close');
			},
			error: function(xml,a,b){
				alert('e');
				netos.ajax.loading(2);
			},
			success: function(xml){
				var act=$('act',xml).text();
				act=parseInt(act);
				
				switch(act){
					case 1:
						eval('pp='+$('pp',xml).text());
						netos.ajax.load(pp);
						break;
					case 2:
						location.reload();
					break;

					case 3:
						location = $('url',xml).text();
					break;

					case 4:
						var id=$('id',xml).text();
						var val=$('val',xml).text();
						if (!id)
						{
							alert('ID捕获失败!请检查最后请求的函数,ajax.txt中记录ajax_op.php获取的值.')
						}else{
							$('#'+id).html(val);
						}
						netos.ajax.loading(5);
					break;

					default:
						var re=$('re',xml).text();
						var rs=$('rs',xml).text();
						netos.ajax.loading(re,rs);
					break;
				}
			}
		});
	},
	run : function(p){
		this.loading();
		$.ajax({
			type: "post",
			url: "ajax_op.php",
			data: p,
			error: function(xml){
				netos.ajax.loading(2);
			},
			complete: function(xml){
				netos.ajax.loading(1);
			},
			success: function(xml){
				var dialog=$('dialog',xml).text();
				dialog=parseInt(dialog);
				if ( dialog == 1){
					$('#work_box').dialog('close');
				}
				var act=$('act',xml).text();
				act=parseInt(act);
				switch(act){
					case 1:
						eval('pp='+$('pp',xml).text());
						netos.ajax.load(pp);
						break;
					case 2:
						location.reload();
					break;

					case 3:
						location = $('url',xml).text();
					break;

					default:
						var re=$('re',xml).text();
						var rs=$('rs',xml).text();
						netos.ajax.loading(re,rs);
					break;
				}
			}
		});
	},
	dialog : function(p,box){
		//this.loading(4);
		$.ajax({
			type: "post",
			url: "ajax_op.php",
			data: p,
			error: function(xml){
				netos.ajax.loading(2);
			},
			cache:false,
			complete: function(xml){
				//netos.ajax.loading(1);
			},
			success: function(xml){
				var str=$('str',xml).text();

					$('#work_box').html(str);
					$('#work_box').dialog('destroy');
					$('#work_box').dialog({title:box.t, width: box.w, height: box.h,modal:true,bgiframe:true});
					$('#work_box').dialog('open');
				
				//this.loading(3);
			}
		});
	},
	dialogold : function(p,box){
		this.loading(4);
		$.ajax({
			type: "post",
			url: "ajax_op.php",
			data: p,
			error: function(xml){
				netos.ajax.loading(2);
			},
			cache:false,
			complete: function(xml){
				//netos.ajax.loading(1);
			},
			success: function(xml){
				var str=$('str',xml).text();
				if (!t_edialog){
					t_edialog=true;
					$('#work_box').html(str);
					$('#work_box').dialog({title:box.t, width: box.w, height: box.h});
					$('#work_box').show();
					$('#work_box').dialogClose();
					$('#work_box').dialogOpen();
				}else{
					$('#work_box').html(str);
					$('#work_box').dialogSet({title:box.t,width: box.w, height: box.h});
					$('#work_box').dialogOpen();
				}
				netos.ajax.loading(3);
			}
		});
	}
}

var netos = netos || {};
netos.tools = {
	setTpl : function(obj,value,keepbox){
		var iseditor = $('#iseditor').val();
		if (iseditor == 1){
			var oEditor = FCKeditorAPI.GetInstance(obj); 
			oEditor.SetHTML(value);
		}else{
			$('#'+obj).val(value);
		}
		//$('#work_box').dialogClose();
		if (keepbox == false) $('#work_box').dialog('close');
		//ScreenClean();
	},

	insTpl : function(obj,value,keepbox){
		var iseditor = $('#iseditor').val();
		if (iseditor == 1){
			var oEditor = FCKeditorAPI.GetInstance(obj); 
			if(oEditor.EditMode  ==  FCK_EDITMODE_WYSIWYG)
			{
				oEditor.InsertHtml(value);
			}else{
				//源代码模式无法插入 oEditor.EditMode=1
				return;
			}
			
		}else{
			$('#'+obj).setCaret();
			$('#'+obj).insertAtCaret(value);
		}
		if (keepbox == false) $('#work_box').dialog('close');
	},

	post : function(url,obj,m){
		var dd;
		$.ajax({
			type: "GET",
			cache: false,
			url: url,
			data: "",
			success: function(data){
				if (m == 'prepend')
				{
					obj.prepend(data);
					
					obj.children(0).fadeIn(1500, function(){
						$(this).slideDown("slow");
					});
				}

				if (m == 'append')
				{
					obj.append(data);
					obj.children(0).slideDown('fast');
				}
				
				if (m == 'remove'){
					$(data).fadeTo("fast", 0.1, function(){
						$(this).slideUp("slow",function(){
							$(this).remove();
						});
					});
					
				}
			}
		});
	},

	block : function(blockid,objstr,action,prefix){
		
		if (!prefix)
		{
			prefix = '';
		}
		if (!objstr)
		{
			action = 'read';
			objstr = ".theme_body_"+blockid;
		}

		if (action == 'read')
		{
			$(objstr).html('loading...');
			setTimeout(
				function(){
					$.ajax({
						type: "POST",
						cache: false,
						url: prefix+_subdir + "index.php?act=block&ajax=1&blockid="+blockid,
						data: "",
						success: function(data){
							$(objstr).html(data);
							return data;
						}
					});
				},Math.random()*(2000-500)+500)
		}
		else
		{
			$(objstr).html($(".theme_body_"+blockid).html());
		}

	},

	/*
	block : function(blockid){
		$.ajax({
			type: "GET",
			cache: false,
			url: "index.php?act=block&ajax=1&blockid="+blockid,
			data: "",
			success: function(data){
				$(".theme_body_"+blockid).html(data);
			}
		});
	},
	*/

	login : function(blockid,objstr){
		if ($("#ajax_signin_name_"+blockid).length < 1 || $("#ajax_signin_pass_"+blockid).length < 1)
		{
			return false;
		}
		if ($("#ajax_signin_name_"+blockid).val()=="" || $("#ajax_signin_pass_"+blockid).val()=="")
		{
			return false;
		}
		if ($("#forward_"+blockid).length > 0 ){
			var forward = $("#forward_"+blockid).val();
		}else{
			var forward = '';
		}
		if ($("#mem_login_"+blockid).length > 0 ){
			var mem_login_ = $("#mem_login_"+blockid).attr("checked");
		}else{
			var mem_login_ = 0;
		}
		$.ajax({
			type: "POST",
			cache: false,
			url: _subdir + "index.php",
			data: "act=post&app=uc&cmd=app-sign-op-in&name="+$("#ajax_signin_name_"+blockid).val()+"&pass="+$("#ajax_signin_pass_"+blockid).val()+"&mem_login="+mem_login_+"&forward="+forward+"&ajax=1&blockid="+blockid,
			success: function(tag){
				arr=eval('('+tag+')');
				//alert(arr.ucsynlogin);
				if (0)
				{
					//当支持ucenter，如何获得并执行js？
					//arr=eval('('+tag+')');
					//alert(arr.ucsynlogin);
					//location.href=arr.forward;
				}
				else
				{
					netos.tools.block(blockid,objstr,'read');

					if (arr.isuc)
					{
						$('#netos_footer').html(arr.ucsynlogin);
					}

					if (arr.forward)
					{
						location.href=arr.forward;
					}
					
				}
			}
		});
	},
	
	login_box : function(name,pass,mem,s_func,b_func){
		
		$.ajax({
			type: "POST",
			cache: false,
			dataType: 'json',
			url: _subdir + "index.php",
			data: "act=post&app=uc&cmd=app-sign-op-in&name="+name+"&pass="+pass+"&mem_login="+mem+"&ajax=1&datatype=json",
			beforeSend: function(XMLHttpRequest){
				if (b_func)
				{
					return eval(b_func);
				}
			},
			complete: function(data, textStatus){
			},
			error: function (XMLHttpRequest, textStatus, errorThrown) {
				alert(errorThrown);
				//alert(data);
				//eval(func);
			},
			success: function(data, textStatus){
				eval(s_func);
			}
		});
	},

	logout : function(blockid,objstr){
		$.ajax({
			type: "POST",
			cache: false,
			url: _subdir + "index.php",
			data: "act=post&app=uc&&cmd=app-sign-op-out&ajax=1&blockid="+blockid,
			success: function(tag){
				arr=eval('('+tag+')');
				netos.tools.block(blockid,objstr,'read');
				
				if (arr.isuc)
				{
					$('#netos_footer').html(arr.ucsynlogout);
				}
			}
		});
	}

}

function ec(i){
	var oEditor = FCKeditorAPI.GetInstance(i); 
	return oEditor.EditorDocument.body.innerHTML;
}

function tabit(tabs,k,code) {
	
	for(i=0;i<tabs.length;i++){
		
		if (tabs[i] == k){
			$('#tabc_'+tabs[i]+code).css('display','block');
			$id('tab_'+tabs[i]+code).className='tabon';
		}else{
			$('#tabc_'+tabs[i]+code).css('display','none');
			$id('tab_'+tabs[i]+code).className='taboff';
		}
	}
	
	//$("#mem_tab").val(k);
	netos.Cookie.Set('tabs_'+code,k,0);
}

function ctreesel(obj,objbak,delbox){
	if (delbox.checked){
		for (var i=0;i<obj.options.length;i++){
			if (obj.options[i].value == delbox.value) {
				obj.remove(i);
				return;
			}
		}
	}else{
		for (var i=0;i<obj.children.length;i++){
			if (obj.children[i].attributes["title"].value.length>0) {
				var nies=obj.children[i];
			}
		}
		for (var i=0;i<objbak.options.length;i++){
			if (objbak.options[i].value == delbox.value) {
				nies.insertAdjacentElement("beforeEnd",objbak.options[i]);
				return;
			}
		}
	}
}

//展开与折叠
function loctrl(p,la,n){
	p=parseInt(p);
	
	for (i = 0; i < la.length; i++){
		switch (p){
			case 0:
			$("#"+la[i]).css("display","none");
			break;

			case 1:
			$("#"+la[i]).css("display","");
			break;

			case 2:
			if ($("#"+la[i]).css("display") == "none"){
				$("#"+la[i]).css("display","");
			}else{
				$("#"+la[i]).css("display","none");
			}
			break;

			case 3:
			if (n == la[i]){
				$("#"+la[i]).css("display","");
			}else{
				$("#"+la[i]).css("display","none");
			}
			break;

			case 4:
			if (n == la[i]){
				if ($("#"+la[i]).css("display") == "none"){
				$("#"+la[i]).css("display","");
				}else{
					$("#"+la[i]).css("display","none");
				}
			}
			break;
		}
		netos.Cookie.Set(la[i],$("#"+la[i]).css("display"),0);
	}
}

//版面的修改
function frame_edit(row,col,rowspan,colspan,width,align,valign){
	$('#frame_row').html(row);
	$('#frame_col').html(col);
	$('#frame_rowspan').val(rowspan);
	$('#frame_colspan').val(colspan);
	$('#frame_width').val(width);
	$('#frame_align').val(align);
	$('#frame_valign').val(valign);
	$('#frame_edit').show();
}

function frame_update(){
	//$('#frame_edit').hide();
	var i=0;

	var f = $('#frame').val();
	var r = $('#frame_row').html();
	var c = $('#frame_col').html();
	var rs = $('#frame_rows').val();
	var cs = $('#frame_cols').val();
	var rsp = $('#frame_rowspan').val();
	var csp = $('#frame_colspan').val();
	var w = $('#frame_width').val();
	var a = $('#frame_align').val();
	var va = $('#frame_valign').val();


	if (rs > 4 || cs > 12){
		if (rs > 4) {
			$('#frame_view').css('height',200);
		}
		if (cs > 12) {
			$('#frame_view').css('width',432);
		}
		$('#frame_view').css('overflow','auto');
	}else{
		$('#frame_view').css('height','');
		$('#frame_view').css('overflow','');
	}

	/*
	var obj=$id('frame_colspan');
	var len = obj.length;

	for(i = 0;i<len;i++){
		obj.options.remove(0);
	}

	var objs;
	for(i = 1;i<=cs;i++){
		objs=document.createElement("option"); 

		objs.text = i+' 列';
		objs.value = i;

		obj.add(objs);
	}

	$('#frame_colspan').val(csp);


	var obj=$id('frame_rowspan');
	var len = obj.length;
	for(i = 0;i<len;i++){
		obj.options.remove(0);
	}
	var objs;
	for(i = 1;i<=rs;i++){
		objs=document.createElement("option"); 

		objs.text = i+' 行';
		objs.value = i;

		obj.add(objs);
	}

	$('#frame_rowspan').val(rsp);
	*/

	var obj;
	//列数
	obj=$("#frame_colspan");
	obj.clearAll();

	for(i = 1;i<=cs;i++){
		obj.addOption(i+' 列',i);
	}

	//行数
	obj=$("#frame_rowspan");
	obj.clearAll();

	for(i = 1;i<=rs;i++){
		obj.addOption(i+' 行',i);
	}

	$('#frame_colspan').val(csp);
	$('#frame_rowspan').val(rsp);
	

	netos.ajax.dload({op:'frame_update',frame:f,row:r,col:c,rows:rs,cols:cs,rowspan:rsp,colspan:csp,width:w,align:a,valign:va});
}

function frame_cancel(){
	$('#frame_edit').hide();
}

function rtextarea(btn,name,tbs){
	var oFCKeditor = new FCKeditor(name);
	oFCKeditor.BasePath='include/fcksys/';
	oFCKeditor.Width='100%';
	oFCKeditor.Height='300px';
	oFCKeditor.ToolbarSet=tbs;
	oFCKeditor.ReplaceTextarea();
	btn.style.display='none';

	$('#iseditor').val(1);
}

function setPointer( theRow, theAction )
{
	 if ( 'over' == theAction )
	 {
	 	theRow.style.backgroundColor='#E7F3FF';
	 	return true;
	 }

	if ( 'out' == theAction )
	 {
	 	theRow.style.backgroundColor='#FFFFFF';
	 	return true;
	 }

}

function pic_width(obj) {
	if(obj.width > screen.width*0.6) {
		obj.width=screen.width*0.6;
		obj.height=screen.height*0.6;
	}
}

function checkall(form, prefix, checkall, type) {

	var checkall = checkall ? checkall : 'chkall';
	var type = type ? type : 'name';
	
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		
		if(type == 'value' && e.type == "checkbox" && e.name != checkall) {
			if(e.name != checkall && (prefix && e.value == prefix)) {
				e.checked = form.elements[checkall].checked;
			}
		}else if(type == 'name' && e.type == "checkbox" && e.name != checkall) {
			if((!prefix || (prefix && e.name.match(prefix)))) {
				e.checked = form.elements[checkall].checked;
			}
		}
		
		
	}

}

function checkAll(type, form, value, checkall, changestyle) {
	var checkall = checkall ? checkall : 'chkall';
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(type == 'option' && e.type == 'radio' && e.value == value && e.disabled != true) {
			e.checked = true;
		} else if(type == 'value' && e.type == 'checkbox' && e.getAttribute('chkvalue') == value) {
			e.checked = form.elements[checkall].checked;
		} else if(type == 'prefix' && e.name && e.name != checkall && (!value || (value && e.name.match(value)))) {
			e.checked = form.elements[checkall].checked;
			if(changestyle && e.parentNode && e.parentNode.tagName.toLowerCase() == 'li') {
				e.parentNode.className = e.checked ? 'checked' : '';
			}
		}
	}
}

function setFocus(evt,obj){
	if (evt.keyCode==13){
		obj.focus();
		return false;
	}
}

function copyToClipboard(txt) {      
     if(window.clipboardData) {      
             window.clipboardData.clearData();      
             window.clipboardData.setData("Text", txt);      
     } else if(navigator.userAgent.indexOf("Opera") != -1) {      
          window.location = txt;      
     } else if (window.netscape) {      
          try {      
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");      
          } catch (e) {      
               alert(" 被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将 'signed.applets.codebase_principal_support'设置为 'true'");      
          }      
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);      
          if (!clip)      
               return;      
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);      
          if (!trans)      
               return;      
          trans.addDataFlavor('text/unicode');      
          var str = new Object();      
          var len = new Object();      
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);      
          var copytext = txt;      
          str.data = copytext;      
          trans.setTransferData("text/unicode",str,copytext.length*2);      
          var clipid = Components.interfaces.nsIClipboard;      
          if (!clip)      
               return false;      
          clip.setData(trans,null,clipid.kGlobalClipboard);      
          alert("复制成功！")      
     }      
}

function copycode(obj) {
	var rng = document.body.createTextRange();
	rng.moveToElementText(obj);
	rng.scrollIntoView();
	rng.select();
	rng.execCommand("Copy");
	rng.collapse(false);
}

function copytext(msg) {
	window.clipboardData.setData("Text",msg);
	alert('已复制到剪贴板，ctrl+v 粘贴');
}

function pastecode(obj) {
	var rng = document.body.createTextRange();
	rng.moveToElementText(obj);
	rng.scrollIntoView();
	rng.select();
	rng.execCommand("Paste");
	rng.collapse(false);
}

function opens(url){
	var w = (screen.availWidth)*.99;
	var h = (screen.availheight)*.82;
	msg=open(url,"disgn","toolbar=yes,scrollbars=yes,status=yes,directories=no,menubar=no,resizable=yes,width="+w+",height="+h+",left=0,top=0");
	msg.focus();
}

function opensview(url){
	priview=open(url,"priview","");
	priview.focus();

}

function opendisgn(url){
	priview=open(url,"disgn","");
	priview.focus();
}

function openwnd(url,w,h){
	var w;
	var h;
	msg=window.open(url,"mydiy","toolbar=yes,scrollbars=yes,status=yes,directories=no,menubar=no,resizable=yes,width="+w+",height="+h+",left=0,top=0");
}

function ConfirmDel(para,mess)
{
	if(confirm('提示：'+mess))
	{
		document.location.href =para;
	}
}

function ask_del(mess)
{
	if(confirm(mess))
	{
		return true;
	}else{
		return false;
	}
}

function checkthis(v,mess)
{
	if(v)
	{
		return true;
	}else{
		alert(mess);
		return false;
	}
}


//chinaz
function IsURL(strUrl) {
    var regular = /^\b(((https?|ftp):\/\/)?[-a-z0-9]+(\.[-a-z0-9]+)*\.(?:com|edu|gov|int|mil|net|org|biz|info|name|museum|asia|coop|aero|[a-z][a-z]|((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]\d)|\d))\b(\/[-a-z0-9_:\@&?=+,.!\/~%\$]*)?)$/i
    if (regular.test(strUrl)) {
        return true;
    }
    else {
        return false;
    }
}

//最近查询构造UL列表
//function FillUrlsForLastSearch(cookieName) {
//    var urls = getcookie(cookieName);
//    var html = "";
//   
//    if (urls != '' && urls != ';') {
//        var urllist = urls.split('|');
//        for (var i = 0; i < urllist.length; i++) {
//            var textval = urllist[i];
//            html += "<li><a href=\"javascript:InputSetValue('" + textval + "');\">" + textval + "</a></li>";
//        }
//    }
//    else {
//        html += "<li>没有记录</li>"
//    }
//    return html;
//}

function closeIME(e){
    var obj = e.target ? e.target : e.srcElement;
    obj.style.imeMode = 'disabled';
}

function OnPaste(e) {
    var obj = e.target ? e.target : e.srcElement;
    setTimeout("MoveHttp('" + obj.id + "')", 100);
}

function MoveHttp(id) {
    var val = getid(id).value;
    val = val.replace("http://", "");
    var temp = val.split('/');
    if (temp.length <= 2) {
        if (val[val.length - 1] == '/') {
            val = val.substring(0, val.length - 1);
        }
    }
    getid(id).value = val;
}

function OnKeyup(e) {
    var obj = e.target ? e.target : e.srcElement;
    setTimeout("addInput('" + obj.id + "')", 200);
}

function addInput(id) {
    var obj = getid(id);
    if (obj.value.indexOf('。') > 0) {
        obj.value = obj.value.replace('。', '.');
    }
    var tags = document.getElementsByTagName('input');
    for (var i = 0; i < tags.length; i++) {
        if (tags[i].getAttribute('url') == 'true' && tags[i] != obj) {
            tags[i].value = obj.value;
        }
    }
}

function killErrors() { 
	return true; 
} 



//window.onerror = killErrors;